﻿<template>
    <div>
        <el-form label-width="150px" :model="UpSalaryStructureDB" :rules="rules" ref="UpSalaryStructure_refs">
            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="姓名" prop="UserId">
                        <el-select v-model="UpSalaryStructureDB.UserId" filterable style="width:100%"  disabled  required placeholder="请选择人员">
                            <el-option value="0" label="请选择人员">请选择人员</el-option>
                            <el-option v-for="(v,k) in AllUsers" :data-userid="v.Id" :value="v.Id" :label="v.UserName" v-text="v.UserName" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="基本工资" prop="BaseWage">
                        <el-input v-model.number="UpSalaryStructureDB.BaseWage"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="年功工资" prop="SeniorityWage">
                        <el-input v-model.number="UpSalaryStructureDB.SeniorityWage"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="岗位责任工资" prop="PositionWage">
                        <el-input v-model.number="UpSalaryStructureDB.PositionWage"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="岗位技能工资" prop="PositionSkillWage">
                        <el-input v-model.number="UpSalaryStructureDB.PositionSkillWage"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="岗位劳动条件" prop="PostLaborConditions">
                        <el-input v-model.number="UpSalaryStructureDB.PostLaborConditions"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>


            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="岗位劳动强度" prop="PostLaborIntensity">
                        <el-input v-model.number.number="UpSalaryStructureDB.PostLaborIntensity"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="岗位脑力强度" prop="PostMentalStrength">
                        <el-input v-model.number="UpSalaryStructureDB.PostMentalStrength"></el-input>
                    </el-form-item>
                </el-col>

            </el-row>


            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="社保补助" prop="SocialSecuritySubsidy">
                        <el-input v-model.number="UpSalaryStructureDB.SocialSecuritySubsidy"></el-input>
                    </el-form-item>
                </el-col>


                <el-col :span="10" :offset="1">
                    <el-form-item label="加班" prop="WorkOvertimeWage">
                        <el-input v-model.number="UpSalaryStructureDB.WorkOvertimeWage"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="出差" prop="BusinessTravelWage">
                        <el-input v-model.number="UpSalaryStructureDB.BusinessTravelWage"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="奖金" prop="BonusWage">
                        <el-input v-model.number="UpSalaryStructureDB.BonusWage"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="证书" prop="CertificateWage">
                        <el-input v-model.number="UpSalaryStructureDB.CertificateWage"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="餐补" prop="MealTonic">
                        <el-input v-model.number="UpSalaryStructureDB.MealTonic"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>


            <el-row>
                <el-col :span="10" :offset="1">
                    <el-form-item label="学历" prop="Education">
                        <el-input v-model.number="UpSalaryStructureDB.Education"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10" :offset="1">
                    <el-form-item label="其它" prop="OtherWage">
                        <el-input v-model.number="UpSalaryStructureDB.OtherWage"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col align="center">
                    <el-button type="success" @click="UpSalaryStructureDBSave">立即提交</el-button>
                </el-col>
            </el-row>
        </el-form>

    </div>

</template>
<script>
    import * as publicjs from "/public/Scriput/Public"
    export default {
        props: {
            UpSalaryStructureDB: {
                type: Object,
                required: true
            },
            AllUsers: {
                type: Array,
                required: true
            },
        },
        name: "UpSalaryStructure",
        data() {
            return {
                rules: {
                    BaseWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    SeniorityWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    PositionWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    PositionSkillWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    PostLaborConditions: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    PostLaborIntensity: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    PostMentalStrength: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    SocialSecuritySubsidy: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    WorkOvertimeWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    BusinessTravelWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    BonusWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    CertificateWage: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    MealTonic: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    Education: [{ required: true, message: '请输入内容信息', trigger: 'blur' },],
                    OtherWage: [
                        { required: true, message: '请输入内容信息', trigger: 'blur' },],
                },
                //    UpSalaryStructureDB:
                //    {
                //        UserId: '0',
                //        BaseWage: '',
                //        SeniorityWage: '',
                //        PositionWage: '',
                //        PositionSkillWage: '',
                //        PostLaborConditions: '',
                //        PostLaborIntensity: '',
                //        PostMentalStrength: '',
                //        SocialSecuritySubsidy: '',
                //        WorkOvertimeWage: '',
                //        BusinessTravelWage: '',
                //        BonusWage: '',
                //        CertificateWage: '',
                //        MealTonic: '',
                //        Education: '',
                //    }

            }
        },
        created() {

        },
        methods: {
            UpSalaryStructureDBSave() {
                this.$refs.UpSalaryStructure_refs.validate((x, d) => {
                    if (x) {
                        let loadding = this.openLoading();
                        this.$http.post("/UserInfo/UpdateSalaryStructure", { salary: this.UpSalaryStructureDB })
                            .then(res => {
                                loadding.close();
                                console.log(res);
                                if (res.data.mes.IsSuccess) {
                                    this.$message.success(res.data.mes.Msg);
                                    this.$parent.$parent.UpSalaryStructureShow = false
                                    this.$parent.$parent.GettableDB()

                                } else {
                                    this.$message.error(res.data.mes.Msg);
                                }
                            });
                    }
                });

            },

            UpSalaryStructureDBreset() {
                this.$refs["UpSalaryStructure_refs"].resetFields();
            },
        },
    }
</script>

<style scoped>
</style>